{% extends "base/base.html" %}

{% comment %}

 Copyright 2013 - Tom Alessi

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and 
 limitations under the License.

{% endcomment %}

{% block content %}

<script type="text/javascript">

   // Dates
   $(function() {

      //Start Date
      $("#s_date").datepicker({dateFormat: 'yy-mm-dd'});

      //Start Time
      $("#s_time").timepicker({
          hourGrid: 4,
          minuteGrid: 10
      });

      //End Date
      $("#e_date").datepicker({dateFormat: 'yy-mm-dd'});

      //End Time
      $("#e_time").timepicker({
          hourGrid: 4,
          minuteGrid: 10
      });

   });

</script>

<br>

<form method="POST" name="isearch" action="/isearch">
{% csrf_token %}

  <fieldset>
    <legend>Search Incidents</legend>

    <div class="row">
      <div class="large-12 columns">
        <span class="radius secondary label">Start Date/Time</span><br><br>
      </div>
    </div>

    <div class="row">
      <div class="large-6 columns {% if form.s_date.errors %}error{% endif %}">
        <input type="text" name="s_date" id="s_date" placeholder="Enter Date" value="{% if form.s_date.data %}{{form.s_date.data}}{% endif %}"/>
        {% if form.s_date.errors %}
        <small class="error">
          {% for error in form.s_date.errors %}{{error}}{% endfor %}
        </small>
        {% endif %}
      </div>

      <div class="large-6 columns {% if form.s_time.errors %}error{% endif %}">
        <input type="text" name="s_time" id="s_time" placeholder="Enter Time" value="{% if form.s_time.data %}{{form.s_time.data}}{% endif %}"/>
        {% if form.s_time.errors %}
        <small class="error">
          {% for error in form.s_time.errors %}{{error}}{% endfor %}
        </small>
        {% endif %}
      </div>
    </div>

    <div class="row">
      <div class="large-12 columns">
        <span class="radius secondary label">End Date/Time</span><br><br>
      </div>
    </div>

    <div class="row">
      <div class="large-6 columns {% if form.e_date.errors %}error{% endif %}">
        <input type="text" name="e_date" id="e_date" placeholder="Enter Date" value="{% if form.e_date.data %}{{form.e_date.data}}{% endif %}"/>
        {% if form.e_date.errors %}
        <small class="error">
          {% for error in form.e_date.errors %}{{error}}{% endfor %}
        </small>
        {% endif %}
      </div>

      <div class="large-6 columns {% if form.e_time.errors %}error{% endif %}">
        <input type="text" name="e_time" id="e_time" placeholder="Enter Time" value="{% if form.e_time.data %}{{form.e_time.data}}{% endif %}"/>
        {% if form.e_time.errors %}
        <small class="error">
          {% for error in form.e_time.errors %}{{error}}{% endfor %}
        </small>
        {% endif %}
      </div>
    </div>

    <div class="row">
      <div class="large-12 columns">
        <p>Timezone: {{TIME_ZONE}}</p>
      </div>
    </div>

    <div class="row">
      <div class="large-12 columns">
        <span class="radius secondary label">Status</span><br><br>
      </div>
    </div>

    <div class="row">
      <div class="large-6 columns {% if form.status.errors %}error{% endif %}">
        <select name="status">
         <option value="">--</option>
         <option value="open">open</option>
         <option value="closed">closed</option>
        </select>
        {% if form.status.errors %}
        <small class="error">
        {% for error in form.status.errors %}{{error}}{% endfor %}
        </small>
        {% endif %}
      </div>
    </div>

    <div class="row">
      <div class="large-12 columns">
        <span class="radius secondary label">Search Text</span><br><br>
      </div>
    </div>

    <div class="row">
      <div class="large-6 columns {% if form.text.errors %}error{% endif %}">
        <input type="text" name="text" placeholder="Enter search text" value=""/>
        {% if form.text.errors %}
        <small class="error">
        {% for error in form.text.errors %}{{error}}{% endfor %}
        </small>
        {% endif %}
      </div>
    </div>

    <div class="row">
      <div class="large-12 columns">
        <input type="submit" class="small button" value="submit"/>
      </div>
    </div>

  </fieldset>
</form>


{% endblock %}



